package cn.jbit.supermarker.util;

public class Page {
	private int totalPageCount=0;//新闻记录总页数
	private int currPageNo=1;//当前页码
	private int pageSize=0;//页面容量(大小)
	private int totalCount=0;//新闻总记录数
	public int getTotalPageCount() {
		return totalPageCount;
	}
	public void setTotalPageCount(int totalPageCount) {
		this.totalPageCount = totalPageCount;
	}
	public int getCurrPageNo() {
		if(totalPageCount==0){
			return 0;
		}
		return currPageNo;
	}
	public void setCurrPageNo(int currPageNo) {
		if(this.currPageNo>0){
			this.currPageNo = currPageNo;
		}
	}
	public int getPageSize() {
		return pageSize;
	}
	public void setPageSize(int pageSize) {
		if(pageSize>0){
			this.pageSize = pageSize;
		}
	}
	public int getTotalCount() {
		return totalCount;
	}
	public void setTotalCount(int totalCount) {
		if(totalCount>0){
			this.totalCount = totalCount;
			this.setTotalPageCount();
		}
	}
	
	//设置总页数
		private void setTotalPageCount() {
			//计算总页数
			if(this.totalCount%this.pageSize>0){
				this.totalPageCount=this.totalCount/this.pageSize+1;
			}else if(this.totalCount%this.pageSize==0){
				this.totalPageCount=this.totalCount/this.pageSize;
			}else{
				this.totalPageCount=0;
			}
			
		}
		public int getStartRow(){
			
			currPageNo=(currPageNo-1)*pageSize;
			
			return currPageNo;
			
			
			
		}
	
}
